home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- // Alias|Wavefront Script File MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 30 July 1996
- // Author: cdt
- //
- //
- // Procedure Name:
- // fitPanel
- //
- // Description:
- // Procedure to do a view fit in the pane under the
- // pointer. Currently this script can be used on model and graph
- // panes, and the view can be fit to either selected or all
- // objects depending on the fitType argument.
- //
- // Only one panel will be affected by this operation.
- //
- // Input Arguments:
- // fitType can be either "-all" or "-selected".
- //
- // Return Value:
- // None.
- //
-
- global proc fitPanel ( string $fitType )
- {
- string $panel = `getPanel -up`;
-
- // Bug fix #138175. Problems arise when using the Hotbox.
- // The cursor may not actually be over a panel. And on Irix
- // the `getPanel -underPointer` command returns empty string
- // when Hotbox is up. The fix is to do a secondary test for
- // the panel with focus.
- //
- if ("" == $panel) {
- $panel = `getPanel -withFocus`;
- }
-
- if ($panel != "") {
- string $type = `getPanel -to $panel`;
-
- if ($type == "modelPanel") {
-
- if ( `optionVar -exists animateRoll` )
- {
- // If you use animate roll
- int $animate = 0;
- $animate = `optionVar -q animateRoll`;
-
- if ($fitType == "-all")
- viewFit -all -animate $animate `lookThru -q $panel`;
- else
- viewFit -animate $animate `lookThru -q $panel`;
- }
- else
- {
- // Maya doesn't use animateRoll
- if ($fitType == "-all")
- viewFit -all `lookThru -q $panel`;
- else
- viewFit `lookThru -q $panel`;
- }
- }
- else if ($type == "hyperPanel") {
- if ($fitType == "-all")
- hyperGraph -e -frameGraph $panel;
- else
- hyperGraph -e -frame $panel;
- }
- else if ($type == "outlinerPanel") {
- // It is kind of tough for the outliner to do show-all
- // so just always do a show-selected
- //
- outlinerEditor -edit -showSelected true $panel;
- }
- else if ($type == "scriptedPanel") {
- string $scriptedType = `scriptedPanel -q -type $panel`;
- switch ($scriptedType) {
- case "graphEditor":
- string $graphEd = ($panel+"GraphEd");
- if ($fitType == "-all") {
- animCurveEditor -e -lookAt all $graphEd;
- } else {
- animCurveEditor -e -lookAt selected $graphEd;
- }
- break;
- case "hyperGraphPanel":
- string $hyperGraphEd = ( $panel + "HyperGraphEd");
- if ($fitType == "-all") {
- hyperGraph -e -frameGraph $hyperGraphEd;
- } else {
- hyperGraph -e -frame $hyperGraphEd;
- }
- break;
- case "hyperShadePanel":
- if ($fitType == "-all") {
- hyperShadePanelFrameAll($panel);
- } else {
- hyperShadePanelFrameSelected($panel);
- }
- break;
- case "miInteractionEditorPanel":
- if (`pluginInfo -q -l MayaInteractive`){
- miInteractionEditorPanelFrame( $panel, $fitType );
- }
- break;
- case "visorPanel":
- if ($fitType == "-all") {
- visorPanelFrameAll($panel);
- } else {
- visorPanelFrameSelected($panel);
- }
- break;
- case "dopeSheetPanel":
- string $dopeSheetEd = ( $panel + "DopeSheetEd" );
- if( $fitType == "-all" ) {
- dopeSheetEditor -edit -lookAt all $dopeSheetEd;
- } else {
- dopeSheetEditor -edit -lookAt selected $dopeSheetEd;
- }
- break;
- case "polyTexturePlacementPanel":
- string $texWindowEd = $panel;
- if( $fitType == "-all" ) {
- textureWindow -edit -frameAll $texWindowEd;
- } else {
- textureWindow -edit -frameSelected $texWindowEd;
- }
- break;
- case "clipEditorPanel":
- string $traxWindowEd = ( $panel + "ClipEditor" );
- if( $fitType == "-all" ) {
- clipEditor -edit -frameAll $traxWindowEd;
- } else {
- clipEditor -edit -frameAll $traxWindowEd;
- }
- break;
- }
- }
- }
- }
-